﻿Imports Owner.Framework.Data
Imports Owner.Framework.Data.DataFunctions

Namespace Tafi.VisionColor.DataService
    Public Class AccesoriosDS

        Public Function AccesXContratoGetByContrato(ByVal pContract As Integer) As Data.DataTable
            Dim args As QueryArgs
            Try
                args = New QueryArgs

                args.ProcedureName = "AccesXContratoGetByContrato"
                args.Parameters.Add("pAXC_CONTRATO", pContract)
                args.Parameters.Add("pTicketId", 0)

                Return ExecuteDataTable(args)
            Finally
                args = Nothing
            End Try
        End Function

        Public Function SV_PRODUCTOXSOLICITUDGetBySolic(ByVal pReason As Integer) As Data.DataTable
            Dim args As QueryArgs
            Try
                args = New QueryArgs
                args.ProcedureName = "SV_PRODUCTOXSOLICITUDGetBySolic"
                args.Parameters.Add("pPXS_SOLICITUD", pReason)

                Return ExecuteDataTable(args)
            Finally
                args = Nothing
            End Try
        End Function

        Public Function PagosGetSaldos(ByVal pCuenta As Integer, ByVal pConSaldo As Int16, ByVal pDocDestino As Int16, ByVal pContrato As Integer, ByVal pRecibosAll As Int16) As Data.DataTable

            Dim args As QueryArgs
            Try
                args = New QueryArgs
                args.ProcedureName = "PagosGetSaldos"
                args.Parameters.Add("pCuenta", pCuenta)
                args.Parameters.Add("pConSaldo", pConSaldo)
                args.Parameters.Add("pDocDestino", pDocDestino)
                args.Parameters.Add("pContrato", pContrato)
                args.Parameters.Add("pRecibosAll", pRecibosAll)

                Return ExecuteDataTable(args)
            Finally
                args = Nothing
            End Try
        End Function

        Public Function PRODUCTOSGetOne(ByVal pProducto As Integer) As Data.DataTable

            Dim args As QueryArgs
            Dim oDT As Data.DataTable
            Dim oPrecio As Double

            Try
                args = New QueryArgs
                args.ProcedureName = "PRODUCTOSGetOne"
                args.Parameters.Add("PRO_NUMERO", pProducto)

                oDT = ExecuteDataTable(args)

                If Not oDT Is Nothing Then

                    If oDT.Rows.Count > 0 Then
                        Return oDT
                    End If

                End If

            Finally
                args = Nothing
                oDT = Nothing
                oPrecio = Nothing
            End Try
        End Function



        Public Function web_ReasonEnabledGetOne(ByVal pReason As Integer) As Entities.Solicitud
            Dim args As QueryArgs
            Dim oDT As Data.DataTable
            Dim oSolicitud As Entities.Solicitud

            Try
                args = New QueryArgs
                args.ProcedureName = "web_ReasonEnabledGetOne"
                args.Parameters.Add("pReasonId", pReason)
                args.ConnectionKey = Owner.Framework.Configuration.SettingsManager.GetValue("Hera")
                oDT = ExecuteDataTable(args)

                If oDT.Rows.Count > 0 Then
                    oSolicitud = New Entities.Solicitud

                    oSolicitud.Reason = If(IsDBNull((oDT.Rows(0)("WRE_Reason"))), 0, (oDT.Rows(0)("WRE_Reason")))
                    oSolicitud.AddFact = If(IsDBNull((oDT.Rows(0)("WRE_AddFact"))), 0, (oDT.Rows(0)("WRE_AddFact")))
                    oSolicitud.ReqFechas = If(IsDBNull((oDT.Rows(0)("WRE_ReqDate"))), 0, (oDT.Rows(0)("WRE_ReqDate")))
                    oSolicitud.ReqSmartCard = If(IsDBNull((oDT.Rows(0)("WRE_ReqSC"))), 0, (oDT.Rows(0)("WRE_ReqSC")))

                    Return oSolicitud
                End If
            Finally
                args = Nothing
                oDT = Nothing
                oSolicitud = Nothing
            End Try
        End Function

        Public Function ALICUOTASGetOne(ByVal pAlNumero As Int16) As Double
            Dim args As QueryArgs
            Dim oDT As Data.DataTable
            Dim oPrecio As Double

            Try
                args = New QueryArgs
                args.ProcedureName = "ALICUOTASGetOne"
                args.Parameters.Add("AL_NUMERO", pAlNumero)

                oDT = ExecuteDataTable(args)

                If Not oDT Is Nothing Then

                    If oDT.Rows.Count > 0 Then
                        Return oDT.Rows(0)("AL_PORCEN")
                    End If

                Else
                    Return -1
                End If

            Finally
                args = Nothing
                oDT = Nothing
                oPrecio = Nothing
            End Try

        End Function



    End Class
End Namespace


